//
// Created by zxh on 2020-4-30.
//

#include "netConfig.h"

void Net_Config(void ) {

    String Settings = null;
    ContentResolver cr = this.getContentResolver();

    try
    {
        if (Settings.System.getInt(cr, Settings.System.WIFI_USE_STATIC_IP) == 0) {
            Log.d("Demo", "No use Static IP!");
        } else {
            Log.d("Demo", "use Static IP and Change IP to 192.168.1.123!");
            Settings.System.putString(cr, Settings.System.WIFI_STATIC_IP, "192.168.1.125");
            Settings.System.putString(cr, Settings.System.WIFI_STATIC_GATEWAY, "192.168.1.1");
            Settings.System.putString(cr, Settings.System.WIFI_STATIC_NETMASK, "255.255.255.0");
            Settings.System.putString(cr, Settings.System.WIFI_STATIC_DNS1, "202.103.24.68");
            Settings.System.putString(cr, Settings.System.WIFI_STATIC_DNS2, "202.103.0.68");
        }
    }
    catch(SettingNotFoundExceptione) {
// TODO Auto-generated catch block
        e.printStackTrace();
    }
}
